<template>
    <view class="gjl-view">
        <view class="main">
            <view class="main-center">
                <image class="bg-img" src="https://img.thumbrary.com/copartner-page.png" mode=""></image>
                <view class="btn-box">
                    <view class="btn1" :style="{'background':!vipCardNum?'#D6D6D6':'#F39415'}" @click="toForm">
                        {{!vipCardNum?'您当前没有权限':'立即申请'}}
                    </view>
                    <view class="btn-text" :style="{'visibility':!vipCardNum?'':'hidden'}" @click="$routerTo({path:'/pagesMine/copartner/howCopartner'})">
                        点击查看如何获取权限
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data(){
            return {
                index: 1
            }
        },
        onLoad(item){
            this.index = item.index
        },
        computed:{
            vipCardNum(){
                return this.$store.getters.vipCardNum
            }
        },
        methods:{
            // 上传图片
            upLoadImg(){
                    uni.chooseImage({
                        success: (chooseImageRes) => {
                            const tempFilePaths = chooseImageRes.tempFilePaths;
                            uni.uploadFile({
                                url: 'https://admin.thumbrary.com/admin/uploadFile', //仅为示例，非真实的接口地址
                                filePath: tempFilePaths[0],
                                name: 'image',
                                formData: {
                                    type: 'image'
                                },
                                success: (uploadFileRes) => {
                                    console.log(uploadFileRes.data,JSON.parse(uploadFileRes.data));
                                }
                            });
                        }
                    });

            },
            toForm(){
                if(!this.vipCardNum){
                    return
                }
                this.$routerTo({path:'/pagesMine/copartner/form'})
            }
        }
    }
</script>

<style scoped lang="scss">
    .gjl-view{
        min-height: 100%;
        overflow: hidden;
        .main{

            .main-center{
                height: 1790rpx;
                position: relative;
                .bg-img{
                    height: 100%;
                    width: 100%;
                }
                .btn-box{
                    position: absolute;
                    width: 100%;
                    bottom: 130rpx;
                    left: 0;
                    text-align: center;
                    .btn1{
                        border-radius: 50px;
                        display: inline-block;
                        padding: 26rpx 178rpx;
                        font-size:32rpx;
                        font-weight:400;
                        color:rgba(255,255,255,1);
                    }
                    .btn-text{
                        margin-top: 28rpx;
                        font-size:24rpx;
                        font-weight:400;
                        color:rgba(153,153,153,1);
                    }
                }
            }
        }
    }
</style>
